Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented May 10, 2025

Link issues

fixes #6009

Summary By Copilot

This pull request introduces a new property, IgnoreWhenExport, across multiple classes and interfaces in the BootstrapBlazor library. The property determines whether a column should be ignored during export operations. Additionally, related logic and unit tests have been updated to support and validate this new functionality.

Feature Addition: IgnoreWhenExport Property

  • Property Definition: Added the IgnoreWhenExport property to the ITableColumn interface and its implementations (AutoGenerateColumnAttribute, InternalTableColumn, TableColumn) to allow columns to be conditionally excluded during export operations. (src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs - [1] src/BootstrapBlazor/Components/Table/ITableColumn.cs - [2] src/BootstrapBlazor/Components/Table/InternalTableColumn.cs - [3] src/BootstrapBlazor/Components/Table/TableColumn.cs - [4]

  • Helper Method: Introduced a new helper method, GetIgnoreExport, in the ITableColumnExtensions class to simplify the evaluation of the IgnoreWhenExport property. (src/BootstrapBlazor/Extensions/ITableColumnExtensions.cs - src/BootstrapBlazor/Extensions/ITableColumnExtensions.csR347-R348)

Logic Updates

Unit Tests

  • New Tests: Added unit tests to verify the functionality of the IgnoreWhenExport property, including its behavior in column filtering and export scenarios. (test/UnitTest/Components/TableTest.cs - test/UnitTest/Components/TableTest.csR8211-R8241)

  • Updated Tests: Enhanced existing tests to validate the inclusion of the IgnoreWhenExport property in column definitions and its propagation across components. (test/UnitTest/Attributes/AutoGenerateClassTest.cs - [1] [2] test/UnitTest/Components/InternalTableColumnTest.cs - [3] test/UnitTest/Utils/UtilityTest.cs - [4]

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add a new IgnoreWhenExport property to table columns to allow selective exclusion of columns during export operations

New Features:

  • Introduced IgnoreWhenExport property for table columns to control column visibility during export

Enhancements:

  • Updated export filtering logic to respect the new IgnoreWhenExport property
  • Extended column attribute copying to include the new property

Tests:

  • Added unit tests to verify the IgnoreWhenExport functionality in table column filtering and export scenarios

@ArgoZhang ArgoZhang requested a review from Copilot May 10, 2025 04:04
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 10, 2025

Reviewer's Guide

This pull request introduces an IgnoreWhenExport boolean property to table column configurations, enabling selective exclusion of columns during data export. The implementation involved adding this property to the ITableColumn interface and its concrete classes (TableColumn, AutoGenerateColumnAttribute, InternalTableColumn). An extension method GetIgnoreExport was added for convenient access, and the CopyValue method was updated to include this new property. The core logic change is in Table.razor.Toolbar.cs, where GetVisibleColumns now filters columns based on IgnoreWhenExport. Corresponding unit tests were added and updated to ensure the new feature's correctness.

File-Level Changes

Change Details Files
Introduced the IgnoreWhenExport property to table column interfaces and classes to allow columns to be skipped during export.
  • Defined bool? IgnoreWhenExport in the ITableColumn interface.
  • Implemented the IgnoreWhenExport property in derived classes.
src/BootstrapBlazor/Components/Table/ITableColumn.cs
src/BootstrapBlazor/Components/Table/TableColumn.cs
src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs
src/BootstrapBlazor/Components/Table/InternalTableColumn.cs
Integrated the IgnoreWhenExport property into the table's export mechanism and column utility functions.
  • Added GetIgnoreExport() helper method to ITableColumnExtensions for consistent property evaluation.
  • Modified GetVisibleColumns() in Table.razor.Toolbar.cs to exclude columns marked for export ignorance.
  • Updated CopyValue() in ITableColumnExtensions to handle the new property during column duplication.
src/BootstrapBlazor/Extensions/ITableColumnExtensions.cs
src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Added and updated unit tests to verify the behavior of the IgnoreWhenExport feature across different scenarios.
  • Introduced a new test case specifically validating the export filtering logic.
  • Updated existing tests for column attributes and utility methods to reflect the new property.
test/UnitTest/Components/TableTest.cs
test/UnitTest/Attributes/AutoGenerateClassTest.cs
test/UnitTest/Components/InternalTableColumnTest.cs
test/UnitTest/Utils/UtilityTest.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#6009 Add a property to TableColumn to allow ignoring a column during export.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added the enhancement New feature or request label May 10, 2025
@bb-auto bb-auto bot added this to the v9.6.0 milestone May 10, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the new IgnoreWhenExport property to the table column implementations in the BootstrapBlazor library so that columns can be conditionally excluded during export operations. The key changes include:

  • Adding the IgnoreWhenExport property to interfaces and classes (ITableColumn, TableColumn, InternalTableColumn, AutoGenerateColumnAttribute).
  • Updating the helper methods and copy logic to support the new property.
  • Adding and updating unit tests to verify the new export filtering behavior.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/UnitTest/Utils/UtilityTest.cs Updated tests to verify IgnoreWhenExport on generated table columns
test/UnitTest/Components/TableTest.cs Added unit tests to assert export filtering of columns via IgnoreWhenExport
test/UnitTest/Components/InternalTableColumnTest.cs Extended property assignments with IgnoreWhenExport
test/UnitTest/Attributes/AutoGenerateClassTest.cs Updated tests for AutoGenerateColumn attribute ensuring IgnoreWhenExport propagates
src/BootstrapBlazor/Extensions/ITableColumnExtensions.cs Added support for IgnoreWhenExport in CopyValue and added GetIgnoreExport helper
src/BootstrapBlazor/Components/Table/TableColumn.cs Introduced new parameter IgnoreWhenExport
src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs Updated visible columns filtering to account for IgnoreWhenExport
src/BootstrapBlazor/Components/Table/InternalTableColumn.cs Added the IgnoreWhenExport property
src/BootstrapBlazor/Components/Table/ITableColumn.cs Extended the interface with IgnoreWhenExport property
src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs Added the IgnoreWhenExport property to the attribute

@ArgoZhang ArgoZhang enabled auto-merge (squash) May 10, 2025 04:04
@codecov
Copy link

codecov bot commented May 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f89a1fa) to head (38cf1e1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6011   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          670       670           
  Lines        30646     30651    +5     
  Branches      4361      4362    +1     
=========================================
+ Hits         30646     30651    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ArgoZhang - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang merged commit 0a920d3 into main May 10, 2025
6 checks passed
@ArgoZhang ArgoZhang deleted the feat-table-export-ignore branch May 10, 2025 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(TableColumn): add IgnoreWhenExport parameter

2 participants